package com.zsy.springframework.beans.facotry.support;

import com.zsy.springframework.beans.facotry.jiekou.one.BeanDefinitionReader;
import com.zsy.springframework.beans.facotry.jiekou.one.BeanDefinitionRegistry;
import com.zsy.springframework.resourceloader.jiekou.ResourceLoader;
import com.zsy.springframework.resourceloader.loader.DefaultResourceLoader;

//顶级接口的实现 都是由抽象类来实现，然后一层层的继承，
//子类然后一步步的实现具体的功能
public abstract class AbstractBeanDefinitionReader implements BeanDefinitionReader {
    private final BeanDefinitionRegistry registry;
    private final ResourceLoader loader;
    //这里的操作是将上面两个顶级的接口封装到自己的构造函数当中，不让别人获取
    //目的就是为了安全
    //protected 同一个包下+ 子类

    protected AbstractBeanDefinitionReader(BeanDefinitionRegistry registry, ResourceLoader loader) {
        this.registry = registry;
        this.loader = loader;
    }

    public AbstractBeanDefinitionReader(BeanDefinitionRegistry registry) {
        this(registry, new DefaultResourceLoader());
    }

    @Override
    public BeanDefinitionRegistry getRegistry() {
        return registry;
    }

    @Override
    public ResourceLoader getResourceLoader() {
        return loader;
    }
}
